#define _CRT_SECURE_NO_WARNINGS 1
#include<iostream>
using namespace std;
string s = "words and 987";
typedef long long ll;
const int N = 210;
ll solve()
{
	ll ret = 0;
	int n = s.size();
	int flag = 0;
	for (int i = 0; i < n; i++)
	{
		if (s[i] == '-' && ret == 0)
		{
			cout << '-';
		}
		while (s[i] >= '0' && s[i] <= '9')
		{
			ret = ret * 10 + s[i] - '0';
			i++;
			flag = 1;
		}
		if (flag == 1)
		{
			break;
		}
	}
	return ret;
}
int main()
{
	ll ret = solve();
	cout << ret ;
	system("pause");
	return 0;
}